﻿<%@ WebHandler Language="C#" Class="ShowListArchive" %>

using System;
using System.Web;
using System.Text;
using System.Data;
using Chenxin.Lib.Utility;

public class ShowListArchive : AjaxHandlerBase
{
    /// <summary>
    /// 基本权限项
    /// </summary>
    public ShowListArchive()
    {
        //作废报备
        htTypePermit.Add("cancelarchive", Constants.Permit_CancelContractArchive);
        //修改报备
        htTypePermit.Add("updarchive", Constants.Permit_UpdContractArchive);
        //法务回复
        htTypePermit.Add("savelawtoreply", Constants.Permit_LawToReplyContractArchive);           
        //办证回复
        htTypePermit.Add("saveapplydoctoreply", Constants.Permit_ApplyDocToReplyContractArchive);
        //贷款回复
        htTypePermit.Add("saveloantoreply", Constants.Permit_LoanToReplyContractArchive);
        //日常回复
        htTypePermit.Add("savedailytoreply", Constants.Permit_ReplyContractArchive);
        //导出报备
        htTypePermit.Add("export", Constants.Permit_ExportContractArchive);
        //上传附件
        htTypePermit.Add("uploadattachment", Constants.Permit_UploadFileContractArchive);
    }

    //可上传附件类型
    public static string[] FileExt = new string[] { ".xls", 
                                                    ".doc", 
                                                    ".pdf", 
                                                    ".rar", 
                                                    ".zip", 
                                                    ".jpg", 
                                                    ".xlsx", 
                                                    ".docx" };
    
    
    override public void RequestProcess(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        context.Response.AddHeader("pragma", "no-cache");
        context.Response.AddHeader("cache-control", "");
        context.Response.CacheControl = "no-cache";
        
        string strOp = context.Request["op"];
        string strResponse = "";
        switch (strOp.ToLower())
        {
            //获取实体
            case "getmodel":
                strResponse = GetModel(context);
                break;
            //查询
            case "search":
                strResponse = Search(context);
                break;
            //查询日常回复列表
            case "searchdailyreplylist":
                strResponse = SearchDailyReplyList(context);
                break;
            //上传附件(文件)
            case "fileupload":
                FileUpload(context);
                break;
            //法务回复
            case "savelawtoreply":
                strResponse = SaveLawToReply(context);
                break;
            //办证回复
            case "saveapplydoctoreply":
                strResponse = SaveApplyDocToReply(context);
                break;
            //贷款回复
            case "saveloantoreply":
                strResponse = SaveLoanToReply(context);
                break;
            //日常回复
            case "savedailytoreply":
                strResponse = SaveDailyToReply(context);
                break;
            //上传附件(入库)
            case "uploadattachment":
                strResponse = UploadAttachment(context);
                break;
            //作废报备
            case "cancelarchive":
                strResponse = CancelArchive(context);
                break;
            default:
                break;
        }
        context.Response.Write(strResponse);
    }

    /// <summary>
    /// 获取实体
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string GetModel(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = null;

            model = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(new Guid(context.Request["modelid"]));

            if (model != null)
            {
                return retExecResult(Constants.ExecResult.Succ, "获取信息成功！", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Error, "数据不存在，获取信息失败！", "");            
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }
    
    /// <summary>
    /// 查询
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string Search(HttpContext context)
    {
        StringBuilder sb = new StringBuilder();
        
        //排序
        string strOrderField = "CreateTime desc";

        //排序字段名
        if (!string.IsNullOrEmpty(context.Request["sort"]))
        {
            strOrderField = context.Request["sort"];
        }
        Guid city = (string.IsNullOrEmpty(context.Request["cityid"])) ? Guid.Empty : new Guid(context.Request["cityid"]);
        Guid company = (string.IsNullOrEmpty(context.Request["companyid"])) ? Guid.Empty : new Guid(context.Request["companyid"]);
        Guid businessdistrict = (string.IsNullOrEmpty(context.Request["areaid"])) ? Guid.Empty : new Guid(context.Request["areaid"]);
        Guid departs = (string.IsNullOrEmpty(context.Request["departid"])) ? Guid.Empty : new Guid(context.Request["departid"]);
        Guid employee = (string.IsNullOrEmpty(context.Request["userid"])) ? Guid.Empty : new Guid(context.Request["userid"]);
        string Status = context.Request.Params["Status"];
        string PlaceType = context.Request.Params["PlaceType"];

        if (!string.IsNullOrEmpty(PlaceType) && PlaceType.Equals("合同所属"))
        {
            if (company != Guid.Empty)
                sb.AppendFormat(" and BargainCompanyId = '{0}'", company);
            else if (city != Guid.Empty)
                sb.AppendFormat(" and BargainCityId = '{0}'", city);
        }
        else
        {
            if (employee != Guid.Empty)
                sb.AppendFormat(" and (EmployeeId = '{0}') ", employee);
            else if (departs != Guid.Empty)
                sb.AppendFormat(" and (DepartId = '{0}')", departs);
            else if (businessdistrict != Guid.Empty)
            {
                sb.AppendFormat(" and (DepartId in (Select ChildId from v_Hr_Struct_DepartTreeRelation where ParentId = '{0}'))", businessdistrict);
            }
            else if (company != Guid.Empty)
                sb.AppendFormat(" and CompanyId = '{0}'", company);
            else if (city != Guid.Empty)
                sb.AppendFormat(" and CityId = '{0}'", city);
            else
                sb.AppendFormat(" and CompanyId = '{0}'", CurrentUserInfo.CompanyId);
        }

        System.Text.StringBuilder sb1 = new System.Text.StringBuilder();
        //查看所有签约报备权限
        if (CurrentUserInfo.ContainsPermit(Constants.Permit_ViewAllContractArchive))
        {
            sb1.Append(" (1=1) ");
        }
        //查看城市签约报备权限
        else if (CurrentUserInfo.ContainsPermit(Constants.Permit_ViewCityContractArchive))
        {
            sb1.AppendFormat(" CityId = '{0}'", CurrentUserInfo.CityId);
        }
        //查看公司签约报备权限
        else if (CurrentUserInfo.ContainsPermit(Constants.Permit_ViewCompanyContractArchivel))
        {
            sb1.AppendFormat(" CompanyId = '{0}'", CurrentUserInfo.CompanyId);
        }
        //查看部门签约报备权限
        else if (CurrentUserInfo.ContainsPermit(Constants.Permit_ViewDepartContractArchive))
        {
            sb1.Append(" EXISTS(");
            sb1.Append(string.Format("Select 1 from t_Business_EmpSetting M WHERE t_Business_Record_BaseInfo.DepartId=M.DepartId And M.Userid= '{0}' and SearchContractArchive=1", CurrentUserInfo.UserId.ToString()));
            sb1.Append(") ");
        }
        else
        {
            sb1.AppendFormat(" EmployeeId = '{0}'", CurrentUserInfo.UserId);
        }

        //查询条件
        if (!string.IsNullOrEmpty(context.Request["Keyword"]))
        {
            sb.AppendFormat(" and ((HouseAddress like '%{0}%') or (HouseCode like '%{0}%')) ", context.Request["Keyword"]);
        }
        
        //快速搜索(条件)
        if (context.Request["quicktype"] != null)
        {
            switch (context.Request["quicktype"])
            {
                //本日报备
                case "today":
                    sb.AppendFormat("and (DATEDIFF(DD,GETDATE(),BargainTime) = 0)");
                    break;
                //本月报备
                case "thismont":
                    sb.AppendFormat("and (DATEDIFF(MM,GETDATE(),BargainTime) = 0)");
                    break;
                //我的报备
                case "owner":
                    sb.AppendFormat(" and (EmployeeId = '{0}')", CurrentUserInfo.UserId);
                    break;
                //本店报备
                case "departh":
                    sb.AppendFormat(" and (DepartId = '{0}')", CurrentUserInfo.DepartId);
                    break;
                //最新回复
                case "newreply":
                    strOrderField = "AnswerTime desc";
                    break;
                // 最新报备
                case "newarchive":
                    strOrderField = "BargainTime desc";
                    break;
            }
        }
        //页面搜索添加条件
        string strSearchTime = "BargainTime";
        
        if (!string.IsNullOrEmpty(context.Request["Archivetime"]))
        {
            switch (context.Request["Archivetime"])
            {
                //买卖合同时间
                case "10":
                    strSearchTime = "BargainTime";
                    break;
                //贷款合同时间
                case "20":
                    strSearchTime = "LoanTime";
                    break;
                //默认买卖合同时间
                default:
                    strSearchTime = "BargainTime";
                    break;
            }
        }
        if (!string.IsNullOrEmpty(context.Request["Begintime"]))
        {
            sb.AppendFormat(" and {0} >= '{1}' ", strSearchTime, context.Request["Begintime"]);
        }
        if (!string.IsNullOrEmpty(context.Request["Endtime"]))
        {
            sb.AppendFormat(" and {0} < '{1}'", strSearchTime, Convert.ToDateTime(context.Request["Endtime"]).AddDays(1));
        }
        if (string.IsNullOrEmpty(Status))
        {
            sb.Append(" and Status = 0");
        }
        else
        {
            sb.AppendFormat(" and Status = {0}", Status);
        }

        if (!String.IsNullOrEmpty(sb.ToString()))
            sb1.Append(sb.ToString());

        return GetTrddition(context, sb1.ToString(), strOrderField);
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="context"></param>
    /// <param name="strWhere"></param>
    /// <param name="strOrderField"></param>
    /// <returns></returns>
    private string GetTrddition(HttpContext context, string strWhere, string strOrderField)
    {
        try
        {

            string strRet = string.Empty;
            StringBuilder strHtml = new StringBuilder();
            
            Constants.Pagination stuPg = new Constants.Pagination();

            //页码
            int strPageIndex = (string.IsNullOrEmpty(context.Request["pageindex"])) ? 1 : int.Parse(context.Request["pageindex"]) + 1;//页码
            //页显示行数
            int strPageSize = (string.IsNullOrEmpty(context.Request["pagesize"])) ? 30 : int.Parse(context.Request["pagesize"]);//页记录数
            //欲选择字段列表 
            string FieldList = "*";
            //子查询欲选择字段列表
            //string TableFieldList = "a.*,dbo.udf_GetRecordOwnerName(RecordId) as CustomerName,dbo.udf_GetRecordOwnerIDNum(RecordId) as IDNum,b.GJJNum";
            string TableFieldList = "";
            TableFieldList = TableFieldList + "CONVERT(varchar(100), BargainTime, 120) As BargainTime,";
            TableFieldList = TableFieldList + "CONVERT(varchar(100), LoanTime, 120) As LoanTime,";
            TableFieldList = TableFieldList + "(Case When BargainType='面签' Then WorkDepartName Else WorkDepartName + '-'  + WorkPersonName End ) As SignPlace,";
            TableFieldList = TableFieldList + "HouseAddress,DepartName,Employee,TotalPrice,LoanInfo,LonggevityLevel,";
            TableFieldList = TableFieldList + "dbo.udf_GetRecordOwnerName(RecordId) as CustomerName,dbo.udf_GetRecordOwnerIDNum(RecordId) as IDNum,";
            TableFieldList = TableFieldList + "dbo.udf_GetRecordOwnerGJJNum(RecordId) as GJJNum,";
            TableFieldList = TableFieldList + "FundLoanPrice,FundLoanEndYear,BuildingArea,Total_Floor,EvaluatePrice,EvaluateCompany,HouseCode,";
            TableFieldList = TableFieldList + "RecordId,IsAnswer,BargainType,BusinessLoanPrice,LoanBank,Prejudication,BargainCompanyName,";
            TableFieldList = TableFieldList + "WorkDepartName,WorkPersonName,Cur_Floor,CompleteYear,AnswersNum,LoanAnswerContent,LawAnswerContent,ApplyDocAnswerContent";

            //所要查询的表名
            string TableName = "t_Business_Record_BaseInfo";
            //根据sql执行查询
            DataSet ds = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetList(strPageIndex, strPageSize, strOrderField, TableName, strWhere, FieldList, TableFieldList, true);
            //数据量
            int count = (int)ds.Tables[1].Rows[0][0];

            StringBuilder sb = new StringBuilder();
            if( context.Request["showtype"].ToLower().Equals("20"))
            {
                //紧凑显示模式
                    GetCompactHtml2(ds, sb);
                    stuPg.count = count;
                    stuPg.data = sb.ToString();
                    strRet = retExecResult(Constants.ExecResult.Succ, "成功！", stuPg);
            }else{
                //默认传统显示模式
                strHtml.Append("{");
                strHtml.Append("success:'1',");
                strHtml.Append("msg:'',");
                strHtml.AppendFormat("data:{{{0},", Chenxin.Lib.Utility.JsonHelp.Convert2Json(ds.Tables[0]));
                strHtml.AppendFormat("count:'{0}'", ds.Tables[1].Rows[0][0]);
                strHtml.Append("}");
                strHtml.Append("}");
                strRet = strHtml.ToString();
            }

            return strRet;
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }  
    }

    public void GetCompactHtml2(DataSet ds, StringBuilder sb)
    {
        sb.Append("<table style=\"height:100%;\" cellspacing=\"1\" class=\"tabsorternew\" id=\"report\">");
        sb.Append("</table>");
        sb.Append("<div class='div_table'>");
        
        int i = 0;
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            if (i % 2 == 0)
                sb.Append("<div class='info'>");
            else
                sb.Append("<div class='info infobg'>");

            sb.Append("<div class='info_head'>");
            sb.Append("<ul class='single'>");
            if ("面签".Equals(dr["BargainType"]))
            {
                sb.AppendFormat("<li class='listtext' style='width:100px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["WorkDepartName"]);
            }
            else if ("授签".Equals(dr["BargainType"]))
            {
                sb.AppendFormat("<li class='listtext' style='width:100px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["WorkDepartName"].ToString() + "-" + dr["WorkPersonName"].ToString());
            }
            else
            {
                sb.Append("<li class='listtext' style='width:100px;'><span class='ul_span'> -- </span></li>");
            }
            sb.AppendFormat("<li class='listtext' style='width:140px;'><span class='ul_span' title='{0}'>{0}</span></li>", dr["HouseAddress"]);
            sb.AppendFormat("<li class='listtext' style='width:100px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["DepartName"]);
            sb.AppendFormat("<li class='listtext' style='width:50px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["Employee"]);
            sb.AppendFormat("<li class='listtext' style='width:70px;'><span class='ul_span' title='{0:f2}万' >{0:f2}万</span></li>", ((decimal)dr["TotalPrice"] / 10000) );
            sb.AppendFormat("<li class='listtext' style='width:60px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["Cur_Floor"] + "/" + dr["Total_Floor"] + "层");
            sb.AppendFormat("<li class='listtext' style='width:80px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["BuildingArea"] + "㎡");
            sb.AppendFormat("<li class='listtext' style='width:40px;'><span class='ul_span' title='{0}' >{0}</span></li>", dr["CompleteYear"] + "年");
            if (!dr["AnswersNum"].Equals(0))
            {
                sb.AppendFormat("<li class='listtext'><span class='ul_span'>日常回复<a href='javascript:void(0)' title='日常回复有{0}条' name='aDailyReplyNum' val='{1}'><span style='color:red;font-weight:bold;'>{0}</span></a>条</span></li>", dr["AnswersNum"], dr["RecordId"]);
            }
            else
            {
                sb.AppendFormat("<li class='listtext'><span class='ul_span'>日常回复<span style='color:red;font-weight:bold;'>{0}</span>条</span></li>", dr["AnswersNum"]);
            }
            sb.Append("</ul>");
            sb.Append("</div>");

            sb.Append("<div class='info_center'>");
            sb.Append("<ul class='single'>");
            if (!string.IsNullOrEmpty(Convert.ToString(dr["CustomerName"])))
            {
                sb.AppendFormat("<li class='listtext' style='width:180px;' title='主贷人'>主贷人：<span>{0}</span></li>", dr["CustomerName"]);
            }
            else
            {
                sb.Append("<li class='listtext' style='width:180px;' title='暂无主贷人'>主贷人：<span>-- </span></li>");
            }
            sb.AppendFormat("<li class='listtext' style='width:170px;'>签合同：<span>{0}</span></li>", dr["BargainTime"]);
            if (!string.IsNullOrEmpty(Convert.ToString(dr["GJJNum"])))
            {
                sb.AppendFormat("<li class='listtext' style='width:150px;'>公积金号：<span>{0}</span></li>", dr["GJJNum"]);
            }
            else
            {
                sb.Append("<li class='listtext' style='width:150px;' title='暂无公积金账户'>公积金号：<span> -- </span></li>");
            }
            if (!string.IsNullOrEmpty(Convert.ToString(dr["LoanBank"])))
            {
                sb.AppendFormat("<li class='listtext' style='width:130px;'>贷款银行：<span>{0}</span></li>", dr["LoanBank"]);
            }
            else
            {
                sb.Append("<li class='listtext' style='width:130px;' title='暂无贷款银行'>贷款银行：<span> -- </span></li>");
            }
            if (!string.IsNullOrEmpty(Convert.ToString(dr["EvaluateCompany"])))
            {
                sb.AppendFormat("<li class='listtext1'>评估公司：<span>{0}</span></li>", dr["EvaluateCompany"]);
            }
            else
            {
                sb.Append("<li class='listtext1' title='暂无评估公司'>评估公司：<span> -- </span></li>");
            }
            sb.Append("</ul>");
            sb.Append("<ul class='single'>");
            if (!string.IsNullOrEmpty(Convert.ToString(dr["IDNum"])))
            {
                sb.AppendFormat("<li class='listtext' style='width:180px;' title='主贷人身份证'>身份证：<span>{0}</span></li>", dr["IDNum"]);
            }
            else
            {
                sb.Append("<li class='listtext' style='width:180px;' title='暂无主贷人身份证'><span> 暂无主贷人身份证 </span></li>");
            }
            sb.AppendFormat("<li class='listtext' style='width:170px;'>签贷款：<span>{0}</span></li>", dr["LoanTime"]);
            object ojb = dr["FundLoanPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                sb.AppendFormat("<li class='listtext' style='width:150px;'>公积金贷款金额：<span>{0}万</span></li>", Convert.ToInt32((decimal)ojb / 10000));
            }
            else
            {
                sb.Append("<li class='listtext' style='width:150px;' title='暂无金额'>公积金贷款金额：<span> -- 万</span></li>");
            }
            ojb = dr["BusinessLoanPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                sb.AppendFormat("<li class='listtext' style='width:130px;'>商业贷款金额：<span>{0}万</span></li>", Convert.ToInt32((decimal)ojb / 10000));
            }
            else
            {
                sb.Append("<li class='listtext' style='width:130px;' title='暂无金额'>商业贷款金额：<span> --万</span></li>");
            }
            ojb = dr["EvaluatePrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                sb.AppendFormat("<li class='listtext' style='width:130px;'>估价：<span>{0}万</span></li>", Convert.ToInt32((decimal)ojb / 10000));
            }
            else
            {
                sb.Append("<li class='listtext' style='width:130px;' title='暂无金额'>估价：<span> --万</span></li>");
            }
            sb.Append("</ul>");
            sb.Append("<ul class='single'>");
            if (!string.IsNullOrEmpty(Convert.ToString(dr["LoanInfo"])))
            {
                sb.AppendFormat("<li class='listtext' style='width:180px;' title='贷款情况'>贷款情况：<span>{0}</span></li>", dr["LoanInfo"]);
            }
            else
            {
                sb.Append("<li class='listtext' style='width:180px;'>贷款情况：<span title='暂无贷款情况'> -- </span></li>");
            }
            if (!string.IsNullOrEmpty(Convert.ToString(dr["LonggevityLevel"])))
            {
                sb.AppendFormat("<li class='listtext' style='width:170px;'>资信：<span>{0}</span></li>", dr["LonggevityLevel"]);
            }
            else
            {
                sb.Append("<li class='listtext' style='width:170px;' title='暂无资信'>资信：<span> -- </span></li>");
            }
            sb.AppendFormat("<li class='listtext' style='width:150px;'>公积金贷款年限：<span>{0}年</span></li>",DatasetHelper.GetValue(dr,"FundLoanEndYear","--"));
            sb.AppendFormat("<li class='listtext' style='width:130px;'>商业贷款年限：<span>{0}年</span></li>",DatasetHelper.GetValue(dr,"BusinessLoanEndYear","--"));
            sb.AppendFormat("<li class='listtext1'>合同所属：<span>{0}</span></li>", DatasetHelper.GetValue(dr, "BargainCompanyName", "--"));
            sb.Append("</ul>");
            sb.Append("</div>");
            
            sb.Append("<div class='reply_info'>");
            sb.Append("<ul class='single'>");
            if (!string.IsNullOrEmpty(Convert.ToString(dr["LawAnswerContent"])))
            {
                sb.AppendFormat("<li class='listtext_reply' style='width:100%; text-align:left;'>法务回复：<span>{0}</span></li>", dr["LawAnswerContent"]);
            }
            else
            {
                sb.Append("<li class='listtext_reply' style='width:100%; text-align:left;'>法务回复：<span>暂无回复</span></li>");
            }
            sb.Append("</ul>");
            sb.Append("<ul class='single' style='padding-top: 2px;'>");
            if (!string.IsNullOrEmpty(Convert.ToString(dr["LoanAnswerContent"])))
            {
                sb.AppendFormat("<li class='listtext_reply' style='width:100%; text-align:left;'>贷款回复：<span>{0}</span></li>", dr["LoanAnswerContent"]);
            }
            else
            {
                sb.Append("<li class='listtext_reply' style='width:100%; text-align:left;'>贷款回复：<span>暂无回复</span></li>");
            }
            sb.Append("</ul>");
            sb.Append("<ul class='single' style='padding-top: 2px;'>");
            if (!string.IsNullOrEmpty(Convert.ToString(dr["ApplyDocAnswerContent"])))
            {
                sb.AppendFormat("<li class='listtext_reply' style='width:100%; text-align:left;'>办证回复：<span>{0}</span></li>", dr["ApplyDocAnswerContent"]);
            }
            else
            {
                sb.Append("<li class='listtext_reply' style='width:100%; text-align:left;'>办证回复：<span>暂无回复</span></li>");
            }
            sb.Append("</ul>");
            sb.Append("</div>");
            sb.Append("<div>");
            sb.Append("<ul class='single'>");
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='日常回复' name='aDailyReply' val='{0}'><span >日常回复</span></a></li>", dr["RecordId"]);
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='法务回复' name='aLawReply' val='{0}'><span >法务回复</span></a></li>", dr["RecordId"]);
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='贷款回复' name='aLoanReply' val='{0}'><span >贷款回复</span></a></li>", dr["RecordId"]);
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='办证回复' name='aApplyDocReply' val='{0}'><span >办证回复</span></a></li>", dr["RecordId"]);
            sb.Append("<li class='listtext'><div style=\"float:left; padding:3px;\"><span>||</span></div></li>");
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='作废报备' name='aLapseArchive' val='{0}'><span >作废报备</span></a></li>", dr["RecordId"]);
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='修改报备' name='aEditArchive' val='{0}'><span >修改报备</span></a></li>", dr["RecordId"]);
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0)' title='报备详情' name='aArchiveDetail' val='{0}'><span >报备详情</span></a></li>", dr["RecordId"]);
            sb.Append("<li class='listtext'><div style=\"float:left; padding:3px;\"><span>||</span></div></li>");
            sb.AppendFormat("<li class='listtext'><div style=\"float:left; padding:3px;\"><a href='javascript:void(0);' title='上传附件' name='aUploadAttachment' val='{0}'><span >上传附件</span></a></li>", dr["RecordId"]);
            sb.Append("</ul>");
            sb.Append("<ul class='single'>");
            sb.Append("<li class='dotline listtext' style='width:100%; height: 3px; margin-top:20px; overflow: hidden;'></li>");
            sb.Append("</ul>");
            sb.Append("</div>");
            sb.Append("</div>");
            
            i++;
        }

        sb.Append("</div>");

    }
    
    /// <summary>
    /// 查询日常回复列表
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string SearchDailyReplyList(HttpContext context)
    {
        try
        {
            StringBuilder strHtml = new StringBuilder();
            
            if (string.IsNullOrEmpty(context.Request["modelid"]))
            {
                return retExecResult(Constants.ExecResult.Succ, "标识丢失，获取信息失败！", "");
            } 

            int count = 0;
            Constants.Pagination stuPg = new Constants.Pagination();

            //页码
            int strPageIndex = (string.IsNullOrEmpty(context.Request["pageindex"])) ? 1 : int.Parse(context.Request["pageindex"]) + 1;//页码
            //页显示行数
            int strPageSize = (string.IsNullOrEmpty(context.Request["pagesize"])) ? 30 : int.Parse(context.Request["pagesize"]);//页记录数
            //欲选择字段列表 
            string FieldList = "*";
            //子查询欲选择字段列表
            string TableFieldList = "*";
            //条件
            string strWhere = string.Format("MainId = '{0}'", new Guid(context.Request["modelid"]));
            //所要查询的表名
            string TableName = "t_Business_Record_SubInfo3";
            //排序
            string strOrderField = "CreateTime desc";
            //根据sql执行查询
            DataSet ds = Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo3.GetList(strPageIndex, strPageSize, strOrderField, TableName, strWhere, FieldList, TableFieldList, true);
            //数据量
            count = (int)ds.Tables[1].Rows[0][0];

            StringBuilder sb = new StringBuilder();

            stuPg.count = count;
            stuPg.data = sb.ToString();

            strHtml.Append("{");
            strHtml.Append("success:'" + ((int)Constants.ExecResult.Succ).ToString() + "',");
            strHtml.Append("msg:'',");
            strHtml.AppendFormat("data:{{{0},", Chenxin.Lib.Utility.JsonHelp.Convert2Json(ds.Tables[0]));
            strHtml.AppendFormat("count:'{0}'", ds.Tables[1].Rows[0][0]);
            strHtml.Append("}");
            strHtml.Append("}");

            return strHtml.ToString();
            //return string.Format("{{success:'1',data:{{html:'{0}',count:{1}}}}}", CreateGrid(ds.Tables[0], "CreateUserName,CreateTime,AnswerContent", "RecordId"), count);
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }    
    }
    
    /// <summary>
    /// 上传附件
    /// </summary>
    /// <param name="context"></param>
    private void FileUpload(HttpContext context)
    {
        try
        {
            HttpPostedFile file = context.Request.Files["FileData"];
            string strFileName = file.FileName.ToString();
            string strFileExt = strFileName.Substring(strFileName.LastIndexOf('.'));

            bool inExt = false;
            for (int i = 0; i < FileExt.Length; i++)
            {
                if (strFileExt.Equals(FileExt[i].ToString()))
                {
                    inExt = true;
                }
            }

            if (!inExt)
            {
                context.Response.Write(retExecResult(Constants.ExecResult.Error, "" + strFileExt + "文件格式不允许上传！", ""));
                return;
            }
            else
            {
                Fileupload(context, Constants.FilePath_ArchiveReply);
            }
        }
        catch (Exception ex)
        {
            context.Response.Write(retExecResult(Constants.ExecResult.Error, ex.Message, ""));
        }
    }

    /// <summary>
    /// 法务回复
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string SaveLawToReply(HttpContext context)
    {
        try
        {
            
            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = (Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo)JsonHelp.Convert2Entity(context.Request.Params["model"], typeof(Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo));

            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo tbrb = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(model.RecordId);
            tbrb.LawIsAnswer = true;
            tbrb.IsAnswer = true;
            tbrb.LawAnswerContent = model.LawAnswerContent;
            tbrb.AnswerTime = DateTime.Now;
            Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.Update(tbrb);

            if (!string.IsNullOrEmpty(context.Request["filename"]))
            {
                //附件
                Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4 tbrs4 = new Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4();
                tbrs4.RecordId = Guid.NewGuid();
                tbrs4.BargainId = tbrb.RecordId;
                tbrs4.FilePath = Convert.ToString(context.Request["savename"]);
                tbrs4.FileName = Convert.ToString(context.Request["filename"]);
                tbrs4.CreateCityId = CurrentUserInfo.CityId;
                tbrs4.CreateCityName = CurrentUserInfo.CityName;
                tbrs4.CreateCompanyId = CurrentUserInfo.CompanyId;
                tbrs4.CreateCompanyName = CurrentUserInfo.CompanyName;
                tbrs4.CreateDepartmentId = CurrentUserInfo.DepartId;
                tbrs4.CreateDepartmentName = CurrentUserInfo.DepartName;
                tbrs4.CreateUserId = CurrentUserInfo.UserId;
                tbrs4.CreateUserName = CurrentUserInfo.UserName;
                tbrs4.CreateTime = DateTime.Now;

                Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo4.Add(tbrs4);
            }

            string text = CurrentUserInfo.UserName + "：法务回复。房源：[" + tbrb.HouseCode + "]" + tbrb.HouseAddress;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_LawToReply"].ToString());
            
            return retExecResult(Constants.ExecResult.Succ, "回复成功！", "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    /// <summary>
    /// 办证回复
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string SaveApplyDocToReply(HttpContext context)
    {
        try
        {

            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = (Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo)JsonHelp.Convert2Entity(context.Request.Params["model"], typeof(Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo));

            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo tbrb = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(model.RecordId);
            tbrb.ApplyDocIsAnswer = true;
            tbrb.IsAnswer = true;
            tbrb.ApplyDocAnswerContent = model.ApplyDocAnswerContent;
            tbrb.AnswerTime = DateTime.Now;
            Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.Update(tbrb);

            if (!string.IsNullOrEmpty(context.Request["filename"]))
            {
                //附件
                Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4 tbrs4 = new Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4();
                tbrs4.RecordId = Guid.NewGuid();
                tbrs4.BargainId = tbrb.RecordId;
                tbrs4.FilePath = Convert.ToString(context.Request["savename"]);
                tbrs4.FileName = Convert.ToString(context.Request["filename"]);
                tbrs4.CreateCityId = CurrentUserInfo.CityId;
                tbrs4.CreateCityName = CurrentUserInfo.CityName;
                tbrs4.CreateCompanyId = CurrentUserInfo.CompanyId;
                tbrs4.CreateCompanyName = CurrentUserInfo.CompanyName;
                tbrs4.CreateDepartmentId = CurrentUserInfo.DepartId;
                tbrs4.CreateDepartmentName = CurrentUserInfo.DepartName;
                tbrs4.CreateUserId = CurrentUserInfo.UserId;
                tbrs4.CreateUserName = CurrentUserInfo.UserName;
                tbrs4.CreateTime = DateTime.Now;

                Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo4.Add(tbrs4);
            }

            string text = CurrentUserInfo.UserName + "：办证回复。房源：[" + tbrb.HouseCode + "]" + tbrb.HouseAddress;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_ApplyDocToReply"].ToString());

            return retExecResult(Constants.ExecResult.Succ, "回复成功！", "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    /// <summary>
    /// 贷款回复
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string SaveLoanToReply(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = (Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo)JsonHelp.Convert2Entity(context.Request["model"], typeof(Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo));

            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo tbrb = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(model.RecordId);
            tbrb.LoanIsAnswer = true;
            tbrb.IsAnswer = true;
            tbrb.EvaluatePrice = model.EvaluatePrice * 10000;
            tbrb.LonggevityLevel = model.LonggevityLevel;
            tbrb.LoanBank = model.LoanBank;
            tbrb.EvaluateCompany = model.EvaluateCompany;
            tbrb.FundLoanPrice = model.FundLoanPrice * 10000;
            tbrb.FundLoanEndYear = model.FundLoanEndYear;
            tbrb.BusinessLoanPrice = model.BusinessLoanPrice * 10000;
            tbrb.BusinessLoanEndYear = model.BusinessLoanEndYear;
            tbrb.LoanAnswerContent = model.LoanAnswerContent;
            tbrb.AnswerTime = DateTime.Now;
            Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.Update(tbrb);

            if (!string.IsNullOrEmpty(context.Request["filename"]))
            {
                //附件
                Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4 tbrs4 = new Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4();
                tbrs4.RecordId = Guid.NewGuid();
                tbrs4.BargainId = tbrb.RecordId;
                tbrs4.FilePath = Convert.ToString(context.Request["savename"]);
                tbrs4.FileName = Convert.ToString(context.Request["filename"]);
                tbrs4.CreateCityId = CurrentUserInfo.CityId;
                tbrs4.CreateCityName = CurrentUserInfo.CityName;
                tbrs4.CreateCompanyId = CurrentUserInfo.CompanyId;
                tbrs4.CreateCompanyName = CurrentUserInfo.CompanyName;
                tbrs4.CreateDepartmentId = CurrentUserInfo.DepartId;
                tbrs4.CreateDepartmentName = CurrentUserInfo.DepartName;
                tbrs4.CreateUserId = CurrentUserInfo.UserId;
                tbrs4.CreateUserName = CurrentUserInfo.UserName;
                tbrs4.CreateTime = DateTime.Now;

                Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo4.Add(tbrs4);
            }

            string text = CurrentUserInfo.UserName + "：贷款回复。房源：[" + tbrb.HouseCode + "]" + tbrb.HouseAddress;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_LoanToReply"].ToString());
            
            return retExecResult(Constants.ExecResult.Succ, "回复成功！", "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    /// <summary>
    /// 日常回复
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string SaveDailyToReply(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo3 model = (Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo3)JsonHelp.Convert2Entity(context.Request["model"], typeof(Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo3));
            
            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo tbrb = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(model.RecordId);
            tbrb.IsAnswer = true;
            tbrb.AnswersNum = tbrb.AnswersNum + 1;
            tbrb.AnswerTime = DateTime.Now;

            model.MainId = tbrb.RecordId;
            model.RecordId = Guid.NewGuid();
            model.AnswerType = "日常回复";
            model.CreateCityId = CurrentUserInfo.CityId;
            model.CreateCityName = CurrentUserInfo.CityName;
            model.CreateCompanyId = CurrentUserInfo.CompanyId;
            model.CreateCompanyName = CurrentUserInfo.CompanyName;
            model.CreateDepartmentId = CurrentUserInfo.DepartId;
            model.CreateDepartmentName = CurrentUserInfo.DepartName;
            model.CreateUserId = CurrentUserInfo.UserId;
            model.CreateUserName = CurrentUserInfo.UserName;
            model.CreateTime = DateTime.Now;

            Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo3.Add(model);

            if (!string.IsNullOrEmpty(context.Request["filename"]))
            {
                //附件
                Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4 tbrs4 = new Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4();
                tbrs4.RecordId = Guid.NewGuid();
                tbrs4.AnswerId = model.RecordId;
                tbrs4.BargainId = tbrb.RecordId;
                tbrs4.FilePath = Convert.ToString(context.Request["savename"]);
                tbrs4.FileName = Convert.ToString(context.Request["filename"]);
                tbrs4.CreateCityId = CurrentUserInfo.CityId;
                tbrs4.CreateCityName = CurrentUserInfo.CityName;
                tbrs4.CreateCompanyId = CurrentUserInfo.CompanyId;
                tbrs4.CreateCompanyName = CurrentUserInfo.CompanyName;
                tbrs4.CreateDepartmentId = CurrentUserInfo.DepartId;
                tbrs4.CreateDepartmentName = CurrentUserInfo.DepartName;
                tbrs4.CreateUserId = CurrentUserInfo.UserId;
                tbrs4.CreateUserName = CurrentUserInfo.UserName;
                tbrs4.CreateTime = DateTime.Now;

                Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo4.Add(tbrs4);
            }

            string text = CurrentUserInfo.UserName + "：日常回复。房源：[" + tbrb.HouseCode + "]" + tbrb.HouseAddress;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_DailyToReply"].ToString());
            
            Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.Update(tbrb);
            
            return retExecResult(Constants.ExecResult.Succ, "回复成功！", "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }


    /// <summary>
    /// 上传附件（入库）
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string UploadAttachment(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = (Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo)JsonHelp.Convert2Entity(context.Request["model"], typeof(Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo));

            if (!string.IsNullOrEmpty(context.Request["filename"]))
            {
                //附件
                Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4 tbrs4 = new Chenxin.Lib.Business.Entity.t_Business_Record_SubInfo4();
                tbrs4.RecordId = Guid.NewGuid();
                tbrs4.BargainId = model.RecordId;
                tbrs4.FilePath = Convert.ToString(context.Request["savename"]);
                tbrs4.FileName = Convert.ToString(context.Request["filename"]);
                tbrs4.CreateCityId = CurrentUserInfo.CityId;
                tbrs4.CreateCityName = CurrentUserInfo.CityName;
                tbrs4.CreateCompanyId = CurrentUserInfo.CompanyId;
                tbrs4.CreateCompanyName = CurrentUserInfo.CompanyName;
                tbrs4.CreateDepartmentId = CurrentUserInfo.DepartId;
                tbrs4.CreateDepartmentName = CurrentUserInfo.DepartName;
                tbrs4.CreateUserId = CurrentUserInfo.UserId;
                tbrs4.CreateUserName = CurrentUserInfo.UserName;
                tbrs4.CreateTime = DateTime.Now;

                Chenxin.Lib.Business.DAL.t_Business_Record_SubInfo4.Add(tbrs4);
            }

            string text = CurrentUserInfo.UserName + "：上传签约报备附件。房源：[" + model.HouseCode + "]" + model.HouseAddress;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_UploadAttachment"].ToString());

            return retExecResult(Constants.ExecResult.Succ, "上传成功！", "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }
    /// <summary>
    /// 作废报备
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string CancelArchive(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = null;
            if (string.IsNullOrEmpty(context.Request["modelid"]))
            {
                return retExecResult(Constants.ExecResult.Error, "标识丢失，获取信息失败！", "");
            }
            model = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(new Guid(context.Request["modelid"]));
            if (model == null)
            {
                return retExecResult(Constants.ExecResult.Error, "数据不存在，获取信息失败！", "");
            }
            model.Status = -1;//Status状态(0正常，1作废)
            Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.Update(model);

            string text = CurrentUserInfo.UserName + "：作废报备。房源：[" + model.HouseCode + "]" + model.HouseAddress;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_CancelArchive"].ToString());
            
            return retExecResult(Constants.ExecResult.Succ, "作废成功！", "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //public override bool CustomerCheckPermint(HttpContext context, out string strMsg)
    //{
    //    if (context.Request["op"] != null)
    //    {
    //        string op = context.Request["op"].ToLower();
    //        //传递参数用
    //        System.Collections.Hashtable per = new System.Collections.Hashtable();
    //        System.Collections.Hashtable confine = new System.Collections.Hashtable();
    //        //作废报备
    //        if (op.Equals("checkpermit") && ("cancelarchive".Equals(context.Request["code"].ToLower()) || "updarchive".Equals(context.Request["code"].ToLower())))
    //        {
    //            Chenxin.Lib.Business.Entity.t_Business_Record_BaseInfo model = null;
    //            try
    //            {
    //                string id = context.Request["modelid"];

    //                //作废报备
    //                if ("cancelarchive".Equals(context.Request["code"].ToLower()))
    //                {
    //                    if (string.IsNullOrEmpty(id))
    //                    {
    //                        strMsg = retExecResult(Constants.ExecResult.Error, "标识丢失，获取信息失败！", "");
    //                        return false;
    //                    }
    //                    model = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(new Guid(id));
    //                    if (model == null)
    //                    {
    //                        strMsg = retExecResult(Constants.ExecResult.Error, "数据不存在，获取信息失败！", "");
    //                        return false;
    //                    }
    //                    //加入权限项
    //                    per.Add("ALL", Constants.Permit_CancelAllContractArchive);
    //                    per.Add("CITY", Constants.Permit_CancelCityContractArchive);
    //                    per.Add("COMPANY", Constants.Permit_CancelCompanyContractArchivel);
    //                    per.Add("DEPART", Constants.Permit_CancelDepartContractArchive);
    //                    //加入范围
    //                    confine.Add("CityId", model.CityId);
    //                    confine.Add("CompanyId", model.CompanyId);
    //                    confine.Add("OperatorId", model.EmployeeId);
    //                    //检查权限
    //                    return CheckPermint(per, confine, checkDepartPermit(model.DepartId, context.Request["code"].ToLower()), out strMsg);
    //                }
    //                //编辑报备
    //                if ("updarchive".Equals(context.Request["code"].ToLower()))
    //                {
    //                    if (string.IsNullOrEmpty(id))
    //                    {
    //                        strMsg = retExecResult(Constants.ExecResult.Error, "标识丢失，获取信息失败！", "");
    //                        return false;
    //                    }
    //                    model = Chenxin.Lib.Business.DAL.t_Business_Record_BaseInfo.GetModel(new Guid(id));
    //                    if (model == null)
    //                    {
    //                        strMsg = retExecResult(Constants.ExecResult.Error, "数据不存在，获取信息失败！", "");
    //                        return false;
    //                    }
    //                    //加入权限项
    //                    per.Add("ALL", Constants.Permit_UpdAllContractArchive);
    //                    per.Add("CITY", Constants.Permit_UpdCityContractArchive);
    //                    per.Add("COMPANY", Constants.Permit_UpdCompanyContractArchivel);
    //                    per.Add("DEPART", Constants.Permit_UpdDepartContractArchive);
    //                    //加入范围
    //                    confine.Add("CityId", model.CityId);
    //                    confine.Add("CompanyId", model.CompanyId);
    //                    confine.Add("OperatorId", model.EmployeeId);
    //                    //检查权限
    //                    return CheckPermint(per, confine, checkDepartPermit(model.DepartId, context.Request["code"].ToLower()), out strMsg);
    //                }
    //            }
    //            catch (Exception ex)
    //            {
    //                strMsg = retExecResult(Constants.ExecResult.Error, ex.Message, "");

    //                return false;
    //            }

    //        }
    //    }
    //    strMsg = "{success:1,msg:'',data:{permit:true}}";
    //    return true;
    //}

    //public bool checkDepartPermit(Guid departId, string op)
    //{
    //    //检查有无权限
    //    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    //    sb.AppendFormat(" (Departid = '{0}' AND  Userid= '{1}') ", departId, CurrentUserInfo.UserId);
    //    System.Collections.Generic.List<Chenxin.Lib.Business.Entity.t_Business_EmpSetting> list = Chenxin.Lib.Business.DAL.t_Business_EmpSetting.GetListArray(sb.ToString());
    //    if (list.Count > 0)
    //    {
    //        Chenxin.Lib.Business.Entity.t_Business_EmpSetting hrp = list[0];
    //        //作废报备
    //        if ("cancelarchive".Equals(op))
    //        {
    //            return hrp.CancelContractArchive;
    //        }
    //        //编辑报备
    //        if ("updarchive".Equals(op))
    //        {
    //            return hrp.EditContractArchive;
    //        }
    //    }
    //    return false;
    //}
    
}